<!DOCTYPE html>
<style>
  iframe {
    position: absolute;
    left: 100px;
    top: 100px;
    height: 120px;
    width: 120px;
    padding: 10px;
    border: none;
  }
  .spacer {
    height: 2000px;
  }
</style>

<script>
  // Prefer non-composited scrolling because this is a test of non-composited
  // scrollers.
  if (window.internals)
    internals.settings.setPreferCompositingToLCDTextEnabled(false);
</script>

<iframe src="resources/large-body.html"></iframe>
<div id="console"></div>
<div class="spacer"></div>

<script src="../resources/js-test.js"></script>
<script src="../resources/run-after-layout-and-paint.js"></script>
<script src="resources/non-fast-scrollable-region-testing.js"></script>
<script>
  window.jsTestIsAsync = true;
  description('This test ensures non-fast scrollable areas are calculated ' +
              'correctly when page is scaled.');

  onload = function() {
    if (window.internals)
      internals.setPageScaleFactor(2);
    else
      testFailed('This test requires internals.setPageScaleFactor to be available.');

    runAfterLayoutAndPaint(function(){
      nonFastScrollableRects = internals.nonFastScrollableRects(document);
      shouldBe('nonFastScrollableRects.length', '1');
      // The non-fast region in the space of the scaled layer but prints it in
      // absolute coordinates so the rect is scaled here.
      shouldBeEqualToString('rectToString(nonFastScrollableRects[0])', '[220, 220, 240, 240]');

      drawNonFastScrollableRegionOverlays();

      finishJSTest();
    });
  };
</script>
